<template>
	<view class="container">
		<view class="header">
			<view class="header-return" @click="returnclick()"></view>
			<view class="header-title">我的问题</view>
		</view>
		<view class="body">
			<view class=""></view>
			<view class="" style="height: 15vw;">对{{$store.state.user.teacherName}}老师进行评价：</view>
			<uni-rate v-model="rateValue"/>
			<view class=""></view>
		</view>
		<view class="footer">
			<view class="footer-button" @click="submit()">确认评价</view>
		</view>
	</view>
</template>

<script>
	import { getEvaluateEvaluate, getQuestionsQuestionDone, getCounselingCounselingDone } from "@/api/mine/index";
	export default {
		data() {
			return {
				rateValue: 5,
			}
		},
		created() {
		   this.Initialize()
		},
		methods: {
			Initialize(){
				
			},
			submit(){
				this.evaluateevaluate()
			},
			questionsQuestionDone(){
				if(this.$store.state.user.evaluate.kind==0){
					getQuestionsQuestionDone(this.$store.state.user.questionid).then(res => {
						this.$router.push('/pages/mine/index')
					});
				}else{
					getCounselingCounselingDone(this.$store.state.user.questionid).then(res => {
						this.$router.push('/pages/mine/index')
					});
				}
			},
			evaluateevaluate(){
				this.$store.state.user.evaluate.score = this.rateValue
				// console.log("this.$store.state.user.evaluate",this.$store.state.user.evaluate)
				getEvaluateEvaluate(this.$store.state.user.evaluate).then(res => {
					this.$store.state.user.refresh2=!this.$store.state.user.refresh2
					this.questionsQuestionDone()
				});
			},
			returnclick(){
				this.$router.push('/pages/mine/index')
			},
		},
		beforeDestroy() {
		    clearInterval(this.timer);        
		    this.timer = null;
		}
	}
</script>

<style>
	.container {
		font-size: 4vw;
		background-color: #ffffff;
		width: 100vw;
		/* height: 87.3vh; */
		height: 100vh;
		display: grid;
		justify-items: center;
		align-items: center;
		/* grid-template-columns: 1fr; */
		grid-template-rows: 12.5vw 1fr auto;
	}
	.header{
		width: 100%;
		height: 12.5vw;
		background: #ffffff;
		border: 1px solid #F6F7F8;
		display: grid;
		justify-items: center;
		align-items: center;
		/* grid-template-columns: 1fr; */
		/* grid-template-rows: 1fr 1fr; */
	}
	.header-title{
		font-size: 5vw;
	}
	.header-return{
		position: absolute;
		width: 5vw;
		height: 5vw;
		left: 5vw;
		top: 3.5vw;
		background: url(../../static/index/return.svg);
		background-size: 100% 100%;
		cursor: pointer;
	}
	.body{
		width: 100%;
		height: 100%;
		display: grid;
		justify-items: center;
		align-items: center;
		grid-template-rows: 1fr auto auto 1fr;
	}
	
	.footer{
		width: 100%;
		height: 100%;
		display: grid;
		justify-items: center;
		align-items: center;
	}
	.footer-button{
		margin: 1vw 0 1vw 0;
		width: 70vw;
		height: 10vw;
		border-radius: 5vw;
		color: #ffffff;
		background: #1492FF;
		display: grid;
		justify-items: center;
		align-items: center;
		cursor: pointer;
		
	}
</style>